package com.fqgj.xjd.user.client.enums;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/3/15
 * Time: 下午2:21
 */
public enum PlatformEnum {
    IOS(1, "iphone"),
    ANDROID(2, "android"),
    OTHER(3, "other");
    private Integer type;

    private String desc;

    PlatformEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public PlatformEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public PlatformEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static PlatformEnum getEnumByType(Integer type) {
        PlatformEnum platformEnum = null;

        for (PlatformEnum platformEnum1 : PlatformEnum.values()) {
            if (platformEnum1.getType().equals(type)) {
                platformEnum = platformEnum1;
            }
        }

        return platformEnum;
    }
    
    public static PlatformEnum getEnumByDesc(String desc) {
        PlatformEnum platformEnum = null;
        for (PlatformEnum enumObj : PlatformEnum.values()) {
            if (enumObj.getDesc().equals(desc)) {
                platformEnum = enumObj;
                break;
            }
        }
        return platformEnum;
    }
}

